<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>String类的方法测试</title>
    <script src="../../js/jquery-3.4.1.js"></script>
    <script src="../../js/lodash.js"></script>
</head>
<body>

</body>
<script>

    $(() => {
        camelCase();
        endWith();
        testTrim();
    });

    /**
     * 功能:
     *      将字符串转换为驼峰形式.
     * 说明:
     *      1. 没有什么卵用.
     */
    function camelCase() {
        let str1 = 'pull request';
        let str2 = 'pull-request';
        let str3 = 'pull_request';
        console.log(_.camelCase(str1));
        console.log(_.camelCase(str2));
        console.log(_.camelCase(str3));
    }

    /**
     * 功能:
     *      检查字符串string是否以给定的target字符串结尾。
     * 说明:
     *      1. 参数说明:
     *          - 第一个参数: 要检索的字符串;
     *          - 第二个参数: 检索的字符串;
     *          - [可选]第三个参数: 检索的起始位置.
     */
    function endWith() {
        let str1 = 'localhost';
        console.log(str1.endsWith('host'));
        
        console.log(_.endsWith(str1, 'host'));
        console.log(_.endsWith(str1, 'host', 7));
    }

    function testPcmPlay() {

    }

    function testTrim() {
        let res = _.trim("   a   sdasd    ");
        console.log(111, res);
    }

</script>
</html>